import request from "@/utils/request";
import { parseStrEmpty } from "@/utils/tetrabot";

// 查询参数列表
export function API_TemplateList(query) {
  return request({
    url: "/task.template/page.list",
    method: "get",
    params: query,
  });
}
//获取巡检点集合
export function API_pointsList(query) {
  return request({
    url: "/task.template/point.list",
    method: "get",
    params: query,
  });
}
//根据巡检点或者设备id获取图片
export function API_getImgUrl(data) {
  return request({
    url: "/task.template/point.picture.get",
    method: "post",
    data,
  });
}

//模板新增
export function API_addTemplate(data) {
  return request({
    url: "/task.template/add",
    method: "post",
    data,
  });
}
//模板编辑
export function API_editTemplate(data) {
  return request({
    url: "/task.template/edit",
    method: "post",
    data,
  });
}
// 模板删除
export function API_delTemplate(tempIds) {
  return request({
    url: "/task.template/remove/" + tempIds,
    method: "delete",
  });
}
/**立即执行 */
export function API_immediate(data) {
  return request({
    url: "/task.template/immediate.run",
    method: "post",
    data,
  });
}
/**定期执行 */
export function API_regular(data) {
  return request({
    url: "/task.template/regular.run",
    method: "post",
    data,
  });
}
/**周期执行 */
export function API_periodic(data) {
  return request({
    url: "/task.template/periodic.run",
    method: "post",
    data,
  });
}
/**根据id查询模板信息 */
export function API_templateInfo(id) {
  return request({
    url: "/task.template/info.get/" + parseStrEmpty(id),
    method: "get",
  });
}
